package ordinary;

import sun.security.util.Length;

import java.util.Locale;
import java.util.Scanner;
import java.lang.String;
/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Wukong
 * Date: 2022-05-21
 * Time: 17:53
 */

public class Daily {
    public static void main(String[] args) {
        String name="abacdeeg";
        int ret= Search (name);

        System.out.println(ret);
    }
   static int Search(String s){
        int[]count=new int[26];
       for (int i = 0; i < s.length(); i++) {
           char ch=s.charAt(i);
           count[ch-'a']++;
       }
       for (int i = 0; i <s.length(); i++) {
           char ch=s.charAt(i);
           if (count[i-'a']==1){
               return i;
           }
       }
       return -1;
    }


}
class Other{
    public static void main(String[] args) {
            Scanner scanner=new Scanner(System.in);
            while (scanner.hasNext()){

                String S= scanner.nextLine();
               String[] word=S.split(" ",2);
                for (String s:
                    word ) {
                    System.out.println(s);

                }

            }




    }
}
class judge{
    static boolean Estimate(char ch){
        if (ch>='a'&&ch<='z'||ch>=1&&ch<=9) {
            return true;
        }
        return  false;
    }
    public static void main(String[] args) {

        String s="A man, a plan, a canal: Panama";
        s=s.toLowerCase();
        boolean res=judge(s);
        System.out.println(res);
    }
    static boolean judge(String s){
        int left=0;
        int right=s.length()-1;
        while (left<right) {
            while (left < right && !Estimate(s.charAt(left))) {
                left++;
            }
            while (left < right && !Estimate(s.charAt(right))) {
                right--;

            }
            if (s.charAt(left) != s.charAt(right)) {
                return false;
            } else {
                left++;
                right--;
            }

        }
        return true;
   }
}




